<?php
/**
 * This is the base class
 *  
 * @author richard
 */
class WebPublisher_Article
{
	protected $_fields;
	
	protected $_title;
	protected $_changedTime;
	protected $_createdTime;
	protected $_moduleName;
	protected $_userId;
	protected $_articleId;
	
    public function __construct ()
    {
    	$this->_fields = array();
    }
    
    public function __destruct ()
    {
        //TODO - Insert destructor code here
        $this->_fields = array();
    }
    
    public function getField ( string $field ) 
    {
    	if (array_key_exists( $field , $this->_fields)) {
    		return $this->_fields[ $field ];
    	}
    	throw new Exception ('The field you requested does not exist.');
    }
    
    public function hasField ( $field ) 
    {
    	return array_key_exists( $field , $this->_fields);
    }
    
    /* Getters */

    
    /**
	 * @return the $_title
	 */
	public function getTitle() {
		return $this->_title;
	}

	/**
	 * @return the $_changedTime
	 */
	public function getChangedTime() {
		return $this->_changedTime;
	}

	/**
	 * @return the $_createdTime
	 */
	public function getCreatedTime() {
		return $this->_createdTime;
	}

	/**
	 * @return the $_moduleName
	 */
	public function getModuleName() {
		return $this->_moduleName;
	}

	/**
	 * @return the $_articleId
	 */
	public function getArticleId() {
		return $this->_articleId;
	}
	
	/**
	 * @return the $_userId
	 */
	public function getUserId() {
		return $this->_userId;
	}
	
	/* Setters */

	/**
	 * @param field_type $_articleId
	 */
	public function setArticleId($_articleId) {
		$this->_articleId = $_articleId;
		return $this;
	}

	/**
	 * @param field_type $_title
	 */
	public function setTitle($_title) {
		$this->_title = $_title;
		return $this;
	}

	/**
	 * @param field_type $_changedTime
	 */
	public function setChangedTime($_changedTime) {
		$this->_changedTime = $_changedTime;
		return $this;
	}

	/**
	 * @param field_type $_createdTime
	 */
	public function setCreatedTime($_createdTime) {
		$this->_createdTime = $_createdTime;
		return $this;
	}

	/**
	 * @param field_type $_moduleName
	 */
	public function setModuleName($_moduleName) {
		$this->_moduleName = $_moduleName;
		return $this;
	}

	/**
	 * @param field_type $_userId
	 */
	public function setUserId($_userId) {
		$this->_userId = $_userId;
	}


    /* Static functions */
}
